#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<string>
#include<vector>
using namespace std;

int main()
{
    string str1, str2;
    vector<string> v;
    int n, constance = 100;
    cin >> n;
    cin >> str1 >> str2;
    if (!str1.size() || !str2.size())
    {
        cout << -1;
        return 0;
    }
    while (n--)
    {
        string tmp;
        cin >> tmp;
        v.push_back(tmp);
    }
    int left = -1, right = -1; //left->str1  right->str2
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] == str1)
        {
            left = i;
        }
        else if (v[i] == str2)
        {
            right = i;
        }
        if (left != -1 && right != -1)
        {
            int m = abs(right - left);
            if (m < constance)
            {
                constance = m;
            }
        }
    }
    if (!~left || !~right)
    {
        cout << -1;
    }
    else
    {
        cout << constance;
    }
}


#include <iostream>
#include<vector>
using namespace std;

int main()
{
    vector<int> v;
    int n, prize = 0, t = 0, step = 1;
    cin >> n;
    while (n--)
    {
        int x;
        cin >> x;
        v.push_back(x);
    }
    if (3 >= v.size() || v[0] >= v[1])
    {
        t = 1;
    }
    int pos = t;
    while (pos < v.size())
    {
        prize += v[pos];
        if (pos + 2 >= v.size())
        {
            step = 2;
        }
        else if (v[pos + 2] > v[pos + 1])
        {
            step = 1;
        }
        else if (v[pos + 2] == v[pos + 1])
        {
            step = 2;
        }
        else
        {
            step = 2;
        }
        pos += step;
    }
    cout << prize;
}

#include <iostream>
using namespace std;

int main()
{
    float weight = 0;
    char flg = 0;
    cin >> weight >> flg;
    int prize = 0;
    if (weight < 1)
    {
        prize += 20;
    }
    else if (weight >= 1)
    {
        prize += 20;
        float uper = weight - 1;
        int iuper = uper;
        prize += iuper * 1;
        if (uper - iuper > 0 && uper - iuper != 0)
        {
            prize += 1;
        }
    }
    if (flg == 'y')
    {
        prize += 5;
    }
    cout << prize;
    return 0;
}
